package com.lxb.demo3

import org.apache.flink.streaming.api.scala._
import org.apache.flink.table.api.bridge.scala.StreamTableEnvironment

/**
 * @author: albert
 * @date: 2021/5/27 16:37
 * @description:
 */
object FromDataStreamTest2 {
  def main(args: Array[String]): Unit = {

    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
    val tableEnv: StreamTableEnvironment = StreamTableEnvironment.create(env)

    val dataStream: DataStream[User] = env.fromElements(
      new User("Alice", 4),
      new User("Bob", 6),
      new User("Alice", 10))

    var table = tableEnv.fromDataStream(dataStream)
    table.printSchema()

  }
}

case class User(name: String, score: java.lang.Integer)